package com.qding.park.common.core.aspect.handle;

import com.qding.park.common.core.annotation.STORAGE_LOCATION_ENUM;
import com.qding.park.common.core.aspect.context.CacheableContext;
import com.qding.park.common.core.redis.JedisClient;

public abstract class AbstractCacheHandle implements ICacheHandle{

	
	@Override
	public void saveCache(CacheableContext context, JedisClient jedisClient,Object value){
		
		STORAGE_LOCATION_ENUM  location=context.getLocation();
		String key=context.getKey();
		String hashkey=context.getHashKey();
		int expire=context.getExpire();
		
		if(location==STORAGE_LOCATION_ENUM.PLANE){
			jedisClient.set(key, (String)value,expire);
		}else if(location==STORAGE_LOCATION_ENUM.HASH){
			jedisClient.hset(key, hashkey, (String)value);
		}
	}
}
